package kassiopeia.agent.internal.metrics;

import org.springframework.jmx.export.annotation.ManagedOperation;
import org.springframework.jmx.export.annotation.ManagedResource;
import org.springframework.stereotype.Component;

@Component
@ManagedResource
public class MetricsMBean {

    @ManagedOperation
    public Long getOutgoingEventsCounterForStage(String stageId) {
        return MetricsAggregator.getOutgoingEventsCounterForStage(stageId);
    }

    @ManagedOperation
    public Long getProcessedEventsCounterForStage(String stageId) {
        return MetricsAggregator.getProcessedEventsCounterForStage(stageId);
    }

    @ManagedOperation
    public Long getPluginErrorsCounterForStage(String stageId) {
        return MetricsAggregator.getPluginErrorsCounterForStage(stageId);
    }

    @ManagedOperation
    public void resetCounters() {
        MetricsAggregator.reset();
    }
}
